<template>
	<view>
		<uni-section title="科目" type="line">
			<uni-card :is-shadow="true" is-full>
				<text class="uni-h6">{{pName}}</text>
			</uni-card>
		</uni-section>
		<uni-section title="事件标题" type="line">
		  	<uni-card :is-shadow="true" is-full>
		  		<text class="uni-h6">{{item.title}}</text>
		  	</uni-card>
		</uni-section>
		<uni-section title="事件内容" type="line" class="content">
			<rich-text :nodes="item.content" :preview="true"></rich-text>
		</uni-section>
		<uni-section title="备注" type="line">
			<uni-card :is-shadow="true" is-full>
				<textarea :value="item.describes" disabled/>
			</uni-card>
		</uni-section>
	</view>
</template>

<script>
import config from "@/config.js";
import { getSubject} from "@/api/plan/subject";
export default {
	data() {
		return {
			value: 0,	
			pName:'',
			item: {}
		};
	},
	onLoad(option) {
		this.item = JSON.parse(option.item);			
		this.item.content = this.item.content.replace(/\/dev-api/g,config.baseUrl);
		this.item.content = this.item.content.replace(/\<img/g,'<img style="width:100%;height:auto;display:block"');		
		this.getSubjectList();
	},
	methods: {
		/** 查询科目列表  新增今日学习内容时使用 */
		getSubjectList() {
			getSubject(this.item.subjectId).then(response => {
				this.pName = response.data.pName;
			});
		},
	    change(e) {
			console.log("e:", e);
	    },
	},
}		
</script>

<style>
	.example {
		padding: 15px;
		background-color: #fff;
	}
	.content{
		.uni-section-content{
			padding: 0 20px;
		}
	}
</style>